<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function demo() {
            console.log(this);
        }
        var arr = [1, 2, 3, 4]
        var demo1 = demo.bind({ name: "xiaoming" }).bind(333333);
        demo1()
        const A = {};
        A.name = "zhangsan"
        console.log(A);
        /* 以前的定义变量 */
        var color = "red";
        var obj = {
            color: color
        }

        // 简化后
        var obj = {
            color
        }
        console.log(obj);
        // Object.defineProperties(obj,{
        //     "测试":{
        //         value:0,
        //         writable:false,
        //         enumerable:true,
        //         configurable : true
        //     },
        //     "测试2":{
        //         get(){
        //             return this._sex1
        //         },
        //         set:function(value){
        //             this._sex1 = value
        //         },
        //         enumerable:false,
        //         configurable:false
        //     }
        // })
        Object.defineProperty(obj, "sex", {
            get: function () {
                return this._sex1
            },
            set: function (value) {
                this._sex1 = value
            },
            enumerable: true,
            configurable: true
        })
        obj.sex = "an"
        console.log(obj);
        var obj1 = {
            username: "zhangsan",
            password: "123321",
            dog: {
                name: "xiaobai"
            }
        }
        var { password, username, dog } = obj1;
        console.log(username, password, dog);
        var a = {}
        const JID = a //{}
        a.age = 12
        console.log(JID);
    </script>
</body>

</html>